package com.srd.phone.utils.views;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.TextView;

import com.srd.phone.utils.TextSizeUtils;

/**
 * Created by Administrator on 2016/5/4.
 */

public class HollowCircleView extends TextView {

    private Context mContext;

    public HollowCircleView(Context context) {
        this(context, null);
    }

    public HollowCircleView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public HollowCircleView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mContext = context;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        int x = getMeasuredWidth() / 2;
        int y = getMeasuredHeight() / 2;
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setColor(Color.parseColor("#f9d19c"));
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(TextSizeUtils.Dp2Px(mContext, 6));
        canvas.drawCircle(x, y, x - (TextSizeUtils.Dp2Px(mContext, 12)), paint);

        paint.setColor(Color.parseColor("#f5ad50"));
        paint.setStrokeWidth(TextSizeUtils.Dp2Px(mContext, 7));
        canvas.drawCircle(x, y, x - (TextSizeUtils.Dp2Px(mContext, 6)), paint);
    }
}
